Spot-On
spot-on.h
1 /*
2 ** Copyright (c) 2011 - 10^10^10, Alexis Megas.
3 ** All rights reserved.
4 **
5 ** Redistribution and use in source and binary forms, with or without
6 ** modification, are permitted provided that the following conditions
7 ** are met:
8 ** 1. Redistributions of source code must retain the above copyright
9 ** notice, this list of conditions and the following disclaimer.
10 ** 2. Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
13 ** 3. The name of the author may not be used to endorse or promote products
14 ** derived from Spot-On without specific prior written permission.
15 **
16 ** SPOT-ON IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 ** SPOT-ON, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef _spoton_h_
29 #define _spoton_h_
30 
31 #include <QApplication>
32 #include <QCheckBox>
33 #include <QClipboard>
34 #include <QDateTime>
35 #include <QDesktopServices>
36 #include <QDialog>
37 #include <QDir>
38 #include <QElapsedTimer>
39 #include <QFileDialog>
40 #include <QFuture>
41 #include <QFutureWatcher>
42 #include <QHash>
43 #include <QInputDialog>
44 #include <QLineEdit>
45 #include <QLocale>
46 #include <QMainWindow>
47 #include <QMediaPlayer>
48 #include <QMessageBox>
49 #include <QMouseEvent>
50 #ifdef Q_OS_WIN
51 #include <qt_windows.h>
52 #include <QNetworkInterface>
53 #else
54 #include <QNetworkInterface>
55 #endif
56 #include <QPointer>
57 #include <QProcess>
58 #include <QQueue>
59 #include <QScrollBar>
60 #include <QSet>
61 #include <QSettings>
62 #include <QSqlDatabase>
63 #include <QSqlError>
64 #include <QSqlQuery>
65 #include <QSqlRecord>
66 #include <QSslSocket>
67 #include <QStyle>
68 #include <QStyledItemDelegate>
69 #include <QThread>
70 #include <QTimer>
71 #include <QTranslator>
72 #include <QUuid>
73 #if QT_VERSION >= 0x050600 && defined(SPOTON_WEBENGINE_ENABLED)
74 #include <QWebEngineUrlRequestInterceptor>
75 #endif
76 #include <QtDebug>
77 
78 #include <limits>
79 
80 extern "C"
81 {
82 #include "libSpotOn/libspoton.h"
83 }
84 
85 #ifdef Q_OS_MACOS
86 #include "Common/CocoaInitializer.h"
87 #endif
88 
89 #include "spot-on-buzzpage.h"
90 #include "spot-on-defines.h"
91 #include "ui_spot-on-keyboard.h"
92 
93 class QStandardItemModel;
94 
95 class spoton_table_item_delegate: public QStyledItemDelegate
96 {
97  Q_OBJECT
98 
99  public:
100  spoton_table_item_delegate(QObject *parent):QStyledItemDelegate(parent)
101  {
102  }
103 
104  QWidget *createEditor(QWidget *parent,
105  const QStyleOptionViewItem &option,
106  const QModelIndex &index) const
107  {
108  Q_UNUSED(option);
109 
110  QLineEdit *lineEdit = new QLineEdit(parent);
111 
112  lineEdit->setReadOnly(true);
113  lineEdit->setText(index.data().toString());
114  return lineEdit;
115  }
116 };
117 
118 class spoton_virtual_keyboard: public QDialog
119 {
120  Q_OBJECT
121 
122  public:
123  spoton_virtual_keyboard(QWidget *parent):QDialog(parent)
124  {
125  m_ui.setupUi(this);
126  m_ui.passphrase->clear();
127  m_ui.passphrase->setEchoMode(QLineEdit::Password);
128  connect(m_ui.back,
129  SIGNAL(clicked(void)),
130  this,
131  SLOT(slotBack(void)));
132  connect(m_ui.shift,
133  SIGNAL(clicked(void)),
134  this,
135  SLOT(slotShift(void)));
136  connect(m_ui.show,
137  SIGNAL(toggled(bool)),
138  this,
139  SLOT(slotShow(bool)));
140 
141  QLocale::Country country = QLocale::system().country();
142  QStringList row;
143 
144  if(country == QLocale::Germany)
145  row << "°\n^"
146  << "!\n1"
147  << "\"\n2"
148  << "§\n3"
149  << "$\n4"
150  << "%\n5"
151  << "&&\n6"
152  << "/\n7"
153  << "(\n8"
154  << ")\n9"
155  << "=\n0"
156  << "?\nß"
157  << "`\n´";
158  else
159  row << "~\n`"
160  << "!\n1"
161  << "@\n2"
162  << "#\n3"
163  << "$\n4"
164  << "%\n5"
165  << "^\n6"
166  << "&&\n7"
167  << "*\n8"
168  << "(\n9"
169  << ")\n0"
170  << "_\n-"
171  << "+\n=";
172 
173  for(int i = 0; i < row.size(); i++)
174  {
175  QToolButton *button = new QToolButton(this);
176 
177  button->setMinimumSize(45, 45);
178  button->setText(row.at(i));
179  m_ui.number_layout->addWidget(button);
180  }
181 
182  row.clear();
183 
184  if(country == QLocale::Germany)
185  row << "q"
186  << "w"
187  << "e"
188  << "r"
189  << "t"
190  << "z"
191  << "u"
192  << "i"
193  << "o"
194  << "p"
195  << "ü"
196  << "*\n+"
197  << "'\n#";
198  else
199  row << "q"
200  << "w"
201  << "e"
202  << "r"
203  << "t"
204  << "y"
205  << "u"
206  << "i"
207  << "o"
208  << "p"
209  << "{\n["
210  << "}\n]"
211  << "|\n\\";
212 
213  for(int i = 0; i < row.size(); i++)
214  {
215  QToolButton *button = new QToolButton(this);
216 
217  button->setMinimumSize(45, 45);
218  button->setText(row.at(i));
219  m_ui.row1->addWidget(button);
220  }
221 
222  row.clear();
223 
224  if(country == QLocale::Germany)
225  row << "a"
226  << "s"
227  << "d"
228  << "f"
229  << "g"
230  << "h"
231  << "j"
232  << "k"
233  << "l"
234  << "ö"
235  << "ä";
236  else
237  row << "a"
238  << "s"
239  << "d"
240  << "f"
241  << "g"
242  << "h"
243  << "j"
244  << "k"
245  << "l"
246  << ":\n;"
247  << "\"\n'";
248 
249  for(int i = 0; i < row.size(); i++)
250  {
251  QToolButton *button = new QToolButton(this);
252 
253  button->setMinimumSize(45, 45);
254  button->setText(row.at(i));
255  m_ui.row2->addWidget(button);
256  }
257 
258  row.clear();
259 
260  if(country == QLocale::Germany)
261  row << "y"
262  << "x"
263  << "c"
264  << "v"
265  << "b"
266  << "n"
267  << "m"
268  << ";\n,"
269  << ":\n."
270  << "_\n-";
271  else
272  row << "z"
273  << "x"
274  << "c"
275  << "v"
276  << "b"
277  << "n"
278  << "m"
279  << "<\n,"
280  << ">\n."
281  << "?\n/";
282 
283  for(int i = 0; i < row.size(); i++)
284  {
285  QToolButton *button = new QToolButton(this);
286 
287  button->setMinimumSize(45, 45);
288  button->setText(row.at(i));
289  m_ui.row3->addWidget(button);
290  }
291 
292  foreach(QToolButton *button, findChildren<QToolButton *> ())
293  if(button != m_ui.back && button != m_ui.shift)
294  connect(button,
295  SIGNAL(clicked(void)),
296  this,
297  SLOT(slotKeyPressed(void)));
298 
299  setWindowTitle(tr("%1: Virtual Keyboard").arg(SPOTON_APPLICATION_NAME));
300  }
301 
303  {
304  }
305 
306  Ui_spoton_keyboard m_ui;
307 
308  private slots:
309  void slotBack(void)
310  {
311  m_ui.passphrase->backspace();
312  }
313 
314  void slotKeyPressed(void)
315  {
316  QToolButton *button = qobject_cast<QToolButton *> (sender());
317 
318  if(!button)
319  return;
320 
321  QString text(m_ui.passphrase->text());
322 
323  if(button == m_ui.space)
324  text.append(" ");
325  else if(m_ui.shift->isChecked())
326  text.append(button->text().split('\n').value(0).mid(0, 1).toUpper());
327  else if(button->text().contains('\n'))
328  text.append(button->text().split('\n').value(1));
329  else
330  text.append(button->text());
331 
332  m_ui.passphrase->setText(text);
333  }
334 
335  void slotShow(bool state)
336  {
337  if(state)
338  m_ui.passphrase->setEchoMode(QLineEdit::Normal);
339  else
340  m_ui.passphrase->setEchoMode(QLineEdit::Password);
341  }
342 
343  public slots:
344  void slotShift(void)
345  {
346  foreach(QToolButton *button, findChildren<QToolButton *> ())
347  if(button != m_ui.back && button != m_ui.shift)
348  {
349  if(m_ui.shift->isChecked())
350  button->setText(button->text().toUpper());
351  else
352  button->setText(button->text().toLower());
353  }
354  }
355 };
356 
357 class spoton_lineedit: public QLineEdit
358 {
359  Q_OBJECT
360 
361  public:
362  spoton_lineedit(QWidget *parent):QLineEdit(parent)
363  {
364  m_dialog = new spoton_virtual_keyboard(this);
365  }
366 
367  ~spoton_lineedit()
368  {
369  }
370 
371  private:
372  void mouseDoubleClickEvent(QMouseEvent *event)
373  {
374  if(event)
375  if(event->type() == QEvent::MouseButtonDblClick)
376  {
377  m_dialog->m_ui.shift->setChecked(false);
378  m_dialog->m_ui.show->setChecked(false);
379  m_dialog->slotShift();
380  m_dialog->m_ui.passphrase->setFocus();
381 
382  if(m_dialog->exec() == QDialog::Accepted)
383  {
384  QApplication::processEvents();
385  setText(m_dialog->m_ui.passphrase->text());
386  }
387 
388  QApplication::processEvents();
389  m_dialog->m_ui.passphrase->clear();
390  }
391 
392  QLineEdit::mouseDoubleClickEvent(event);
393  }
394 
395  private:
396  spoton_virtual_keyboard *m_dialog;
397 };
398 
399 #include "Common/spot-on-common.h"
400 #include "Common/spot-on-crypt.h"
401 #include "Common/spot-on-external-address.h"
402 #include "Common/spot-on-misc.h"
403 #include "Common/spot-on-send.h"
404 #include "spot-on-chatwindow.h"
405 #include "spot-on-encryptfile.h"
406 #include "spot-on-logviewer.h"
407 #include "spot-on-rosetta.h"
408 #include "spot-on-smpwindow.h"
409 #include "ui_spot-on-controlcenter.h"
410 #include "ui_spot-on-notificationswindow.h"
411 #include "ui_spot-on-options.h"
412 #include "ui_spot-on-poptastic-retrophone-settings.h"
413 #include "ui_spot-on-statisticswindow.h"
414 #include "ui_spot-on-statusbar.h"
415 #include "ui_spot-on-wizard.h"
416 
417 class QProgressDialog;
420 class spoton_rss;
421 class spoton_smp;
423 
425 {
426  public:
427  QByteArray m_public_key;
428  QByteArray m_public_key_hash;
429  QDateTime m_date_time;
430  QString m_key_type;
431 };
432 
433 class spoton: public QMainWindow
434 {
435  Q_OBJECT
436 
437  public:
438  spoton(void);
439  ~spoton();
440  QHash<QString, QPair<QQueue<QString>, QQueue<QByteArray> > > m_chatQueues;
441  QHash<QString, QVariant> m_settings;
442  QHash<QString, quint64> m_chatSequenceNumbers;
443  static char s_keyDelimiter;
444  QHash<QString, spoton_crypt *> crypts(void) const;
445  QMap<QString, QByteArray> SMPWindowStreams(const QStringList &keyTypes) const;
446  QList<QByteArray> retrieveForwardSecrecyInformation(const QString &oid,
447  bool *ok) const;
448  QSqlDatabase urlDatabase(void) const;
449 
450  QSslSocket *kernelSocket(void)
451  {
452  return &m_kernelSocket;
453  }
454 
455  QStandardItemModel *starbeamReceivedModel(void) const;
456  Ui_spoton_mainwindow ui(void) const;
457  spoton_crypt *urlCommonCrypt(void) const;
458  static QHash<QString, QStringList> s_publicKeySizes;
459  static QList<QTableWidgetItem *> findItems(QTableWidget *table,
460  const QString &text,
461  const int column);
462  static QString mapIconToEmoticon(const QString &content);
463  static void prepareDatabasesFromUI(void);
464  void addMessageToReplayQueue(const QString &message1,
465  const QByteArray &message2,
466  const QString &publicKeyHash);
467 
468  private:
469  static const int APPLY_GOLDBUG_TO_LETTER_ERROR_ATTACHMENTS = 1;
470  static const int APPLY_GOLDBUG_TO_LETTER_ERROR_DATABASE = 2;
471  static const int APPLY_GOLDBUG_TO_LETTER_ERROR_GENERAL = 3;
472  static const int APPLY_GOLDBUG_TO_LETTER_ERROR_MEMORY = 4;
473  QAtomicInt m_pqUrlFaultyCounter;
474  QAtomicInt m_starbeamDigestInterrupt;
475  QByteArray m_kernelSocketData;
476  QDateTime m_buzzFavoritesLastModificationTime;
477  QDateTime m_listenersLastModificationTime;
478  QDateTime m_magnetsLastModificationTime;
479  QDateTime m_neighborsLastModificationTime;
480  QDateTime m_participantsLastModificationTime;
481  QDateTime m_starsLastModificationTime;
482  QDialog *m_poptasticRetroPhoneDialog;
483  QElapsedTimer m_urlQueryElapsedTimer;
484  QFuture<QList<QPair<QString, QVariant> > > m_statisticsFuture;
485  QFuture<void> m_generalFuture;
486  QFuture<void> m_neighborsFuture;
487  QFuture<void> m_participantsFuture;
488  QFuture<void> m_pqUrlDatabaseFuture;
489  QFutureWatcher<QList<QPair<QString, QVariant> > > m_statisticsFutureWatcher;
490  QHash<QByteArray, QPointer<spoton_buzzpage> > m_buzzPages;
491  QHash<QByteArray, QString> m_neighborToOidMap;
492  QHash<QByteArray, quint64> m_receivedChatSequenceNumbers;
493  QHash<QByteArray, spoton_forward_secrecy> m_forwardSecrecyRequests;
494  QHash<QString, QByteArray> m_buzzIds;
495  QHash<QString, QPointer<spoton_chatwindow> > m_chatWindows;
496  QHash<QString, QString> m_keysShared;
497  QHash<QString, bool> m_wizardHash;
498  QHash<QString, spoton_crypt *> m_crypts;
499  QHash<QString, spoton_smp *> m_smps; /*
500  ** The objects contained within
501  ** m_smps are destroyed whenever
502  ** participants are removed or
503  ** whenever the UI process terminates.
504  ** Unlike m_chatWindows, m_smps
505  ** purging is less rigid.
506  */
507  QList<QFuture<void> > m_starbeamDigestFutures;
508  QMainWindow *m_addParticipantWindow;
509  QMainWindow *m_notificationsWindow;
510  QMainWindow *m_optionsWindow;
511  QMainWindow *m_statisticsWindow;
512  QMap<int, QHash<QString, QVariant> > m_tabWidgetsProperties;
513  QMap<int, QWidget *> m_tabWidgets; /*
514  ** QTabWidget does not provide
515  ** a method for hiding individual pages.
516  */
517  QPointer<spoton_status_activity> m_statusActivity;
518  QSet<QString> m_urlPrefixes;
519  QSqlDatabase m_urlDatabase;
520  QSslSocket m_kernelSocket;
521  QStandardItemModel *m_starbeamReceivedModel;
522  QStandardItemModel *m_statisticsModel;
523  QString m_defaultStyleSheet;
524  QString m_emailAddressAdded;
525  QString m_urlQuery;
526  QTimer m_buzzStatusTimer;
527  QTimer m_chatInactivityTimer;
528  QTimer m_emailRetrievalTimer;
529  QTimer m_externalAddressDiscovererTimer;
530  QTimer m_generalTimer;
531  QTimer m_kernelUpdateTimer;
532  QTimer m_listenersUpdateTimer;
533  QTimer m_neighborsUpdateTimer;
534  QTimer m_participantsUpdateTimer;
535  QTimer m_starbeamUpdateTimer;
536  QTimer m_tableTimer;
537  QTimer m_updateChatWindowsTimer;
538  QTimer m_webServerInformationTimer;
539  QTimer m_webServerValueChangedTimer;
540  QWidget *m_sbWidget;
541  Ui_spoton_mainwindow m_ui;
542  Ui_spoton_notifications_window m_notificationsUi;
543  Ui_spoton_options m_optionsUi;
544  Ui_spoton_poptasticretrophonesettings m_poptasticRetroPhoneSettingsUi;
545  Ui_spoton_statistics_window m_statisticsUi;
546  Ui_spoton_statusbar m_sb;
547  Ui_spoton_wizard *m_wizardUi;
548  bool m_locked;
549  bool m_quit;
550  quint64 m_urlCurrentPage;
551  quint64 m_urlLimit;
552  quint64 m_urlOffset;
553  quint64 m_urlPages;
554  spoton_crypt *m_urlCommonCrypt;
555  spoton_documentation *m_documentation;
556  spoton_documentation *m_releaseNotes;
557  spoton_echo_key_share *m_echoKeyShare;
558  spoton_encryptfile m_encryptFile;
559  spoton_external_address *m_externalAddress;
560  spoton_logviewer m_logViewer;
561  spoton_rosetta m_rosetta;
562  spoton_rss *m_rss;
563  spoton_smpwindow *m_smpWindow;
564  QByteArray copiedPublicKeyPairToMagnet(const QByteArray &data) const;
565  QByteArray copyMyChatPublicKey(void) const;
566  QByteArray copyMyEmailPublicKey(void) const;
567  QByteArray copyMyOpenLibraryPublicKey(void) const;
568  QByteArray copyMyPoptasticPublicKey(void) const;
569  QByteArray copyMyRosettaPublicKey(void) const;
570  QByteArray copyMyUrlPublicKey(void) const;
571  QByteArray poptasticName(void) const;
572  QByteArray poptasticNameEmail(void) const;
573  QList<QPair<QString, QVariant> > gatherStatistics(void) const;
574  QPixmap pixmapForCountry(const QString &country) const;
575  QString currentTabName(void) const;
576  QString listenerTransport(void) const;
577  QString neighborTransport(void) const;
578  QString participantKeyType(QTableWidget *table) const;
579  QString saveCommonUrlCredentials(const QPair<QByteArray, QByteArray> &keys,
580  const QString &cipherType,
581  const QString &hashType,
582  spoton_crypt *crypt) const;
583  QString savePoptasticAccount(void);
584  QStringList parseAEMagnet(const QString &magnet) const;
585  QThread::Priority neighborThreadPriority(void) const;
586  QWidget *combinationBoxForTable(void) const;
587  bool addFriendsKey(const QByteArray &key,
588  const QString &type,
589  QWidget *parent);
590  bool deleteAllUrls(void);
591  bool isKernelActive(void) const;
592  bool listenerSupportsSslTls(void) const;
593  bool neighborSpecialClient(void) const;
594  bool neighborSupportsSslTls(void) const;
595  bool nodeExists(const QSqlDatabase &db,
596  const QString &identifier,
597  const QString &table) const;
598  bool promptBeforeExit(void);
599  bool saveGemini(const QPair<QByteArray, QByteArray> &gemini,
600  const QString &oid);
601  bool updateMailStatus(const QString &oid, const QString &status);
602  bool verifyInitializationPassphrase(QWidget *parent);
603  bool writeKernelSocketData(const QByteArray &bytes);
604  int applyGoldBugToLetter(const QByteArray &goldbug, const int row);
605  int tabIndexFromName(const QString &name) const;
606  void applyGoldBugToAttachments(const QString &folderOid,
607  const QSqlDatabase &db,
608  int *count,
609  spoton_crypt *crypt,
610  bool *ok);
611  void askKernelToReadStarBeamKeys(void);
612  void authenticate(spoton_crypt *crypt,
613  const QString &oid,
614  const QString &message = "");
615  void authenticationRequested(const QByteArray &data);
616  void cancelUrlQuery(void);
617  void changeEchoMode(const QString &mode, QTableWidget *tableWidget);
618  void cleanup(void);
619  void closeEvent(QCloseEvent *event);
620  void computeFileDigests(const QString &fileName,
621  const QString &oid,
622  spoton_crypt *crypt);
623  void demagnetize(void);
624  void derivativeUpdates(void);
625  void discoverUrls(void);
626  void displayUrlImportResults(const QDateTime &then,
627  const quint64 imported,
628  const quint64 not_imported,
629  const quint64 declined);
630  void forwardSecrecyRequested(const QList<QByteArray> &list);
631  void generalConcurrentMethod(const QHash<QString, QVariant> &settings);
632  void generateHalfGeminis(void);
633  void highlightPaths(void);
634  void importNeighbors(const QString &filePath);
635  void initializeKernelSocket(void);
636  void initializeSMP(const QString &hash);
637  void initializeUrlDistillers(void);
638  void inspectPQUrlDatabase(const QByteArray &name,
639  const QByteArray &password);
640  void joinBuzzChannel(const QUrl &url);
641  void joinDefaultBuzzChannel(void);
642  void magnetize(void);
643  void notify(const QString &text);
644  void playSound(const QString &name);
645  void popForwardSecrecyRequest(const QByteArray &publicKeyHash);
646  void populateAETokens(void);
647  void populateAccounts(const QString &listenerOid);
648  void populateListenerIps(const QString &listenerOid);
649  void populateMOTD(const QString &listenerOid);
650  void populateMail(void);
651  void populateNovas(void);
652  void populatePoptasticWidgets(const QHash<QString, QVariant> &hash);
653  void populateStatistics(const QList<QPair<QString, QVariant> > &list);
654  void populateUrlDistillers();
655  void prepareAndShowInstallationWizard(void);
656  void prepareContextMenuMirrors(void);
657  void prepareListenerIPCombo(void);
658  void prepareOtherOptions(void);
659  void prepareSMP(const QString &hash);
660  void prepareStyleSheet(void);
661  void prepareTabIcons(void);
662  void prepareTimeWidgets(void);
663  void prepareUrlContainers(void);
664  void prepareUrlLabels(void);
665  void prepareVisiblePages(void);
666  void refreshInstitutions(void);
667  void removeFavorite(const bool removeAll);
668  void retrieveNeighbors(void);
669  void retrieveParticipants(spoton_crypt *crypt);
670  void saveDestination(const QString &path);
671  void saveGeoIPPath(const int version, const QString &path);
672  void saveKernelPath(const QString &path);
673  void saveSettings(void);
674  void saveUrlIniPath(const QString &path);
675  void sendBuzzKeysToKernel(void);
676  void sendKeysToKernel(void);
677  void sendMessage(bool *ok);
678  void sendSMPLinkToKernel(const QList<QByteArray> &list,
679  const QString &keyType,
680  const QString &oid);
681  void setSBField(const QString &oid,
682  const QVariant &value,
683  const QString &field);
684  void sharePublicKeyWithParticipant(const QString &keyType);
685  void showError(const QString &error);
686  void showUrls(const QString &link, const QString &querystr);
687  void updatePoptasticNameSettingsFromWidgets(spoton_crypt *crypt);
688  void updatePublicKeysLabel(void);
689  void verifySMPSecret(const QString &hash,
690  const QString &keyType,
691  const QString &oid);
692 
693  private slots:
694  void slotAbout(void);
695  void slotAboutToShowChatSecretsMenu(void);
696  void slotAboutToShowEmailSecretsMenu(void);
697  void slotAcceptBuzzMagnets(bool state);
698  void slotAcceptChatKeys(bool state);
699  void slotAcceptEmailKeys(bool state);
700  void slotAcceptGeminis(bool state);
701  void slotAcceptPublicizedListeners(void);
702  void slotAcceptUrlKeys(bool state);
703  void slotActivateKernel(void);
704  void slotActiveUrlDistribution(bool state);
705  void slotAddAEToken(void);
706  void slotAddAcceptedIP(void);
707  void slotAddAccount(void);
708  void slotAddAttachment(void);
709  void slotAddDistiller(void);
710  void slotAddEtpMagnet(const QString &text = "",
711  const bool displayError = true);
712  void slotAddFriendsKey(void);
713  void slotAddInstitution(const QString &text = "");
714  void slotAddInstitutionCheckBoxToggled(bool state);
715  void slotAddListener(void);
716  void slotAddMagnet(void);
717  void slotAddNeighbor(void);
718  void slotAddReceiveNova(void);
719  void slotAfterFirstShow(void);
720  void slotAllowFSRequest(bool state);
721  void slotApplyOtherOptions(void);
722  void slotAssignNewIPToNeighbor(void);
723  void slotAuthenticate(void);
724  void slotAuthenticationRequestButtonClicked(void);
725  void slotAutoAddSharedSBMagnets(bool state);
726  void slotAutoRetrieveEmail(bool state);
727  void slotBlockNeighbor(void);
728  void slotBluetoothSecurityChanged(int index);
729  void slotBuzzActionsActivated(int index);
730  void slotBuzzChanged(void);
731  void slotBuzzInvite(void);
732  void slotBuzzPageDestroyed(QObject *object);
733  void slotBuzzTools(int index);
734  void slotCallParticipant(void);
735  void slotCallParticipantViaForwardSecrecy(void);
736  void slotChangeTabPosition(int index);
737  void slotChatInactivityTimeout(void);
738  void slotChatPopup(void);
739  void slotChatSecretsActionSelected(void);
740  void slotChatSendMethodChanged(int index);
741  void slotChatTimestamps(bool state);
742  void slotChatWindowDestroyed(void);
743  void slotChatWindowMessageSent(void);
744  void slotClearClipboardBuffer(void);
745  void slotClearOutgoingMessage(void);
746  void slotCloseBuzzTab(int index);
747  void slotCloseTab(void);
748  void slotCommonBuzzChannelsActivated(int index);
749  void slotComputeFileHash(void);
750  void slotConfigurePoptastic(void);
751  void slotConnectAllNeighbors(void);
752  void slotConnectNeighbor(void);
753  void slotCopyAEMagnet(void);
754  void slotCopyAllMyPublicKeys(void);
755  void slotCopyEmailFriendshipBundle(void);
756  void slotCopyEmailKeys(void);
757  void slotCopyEtpMagnet(void);
758  void slotCopyFileHash(void);
759  void slotCopyFriendshipBundle(void);
760  void slotCopyInstitution(void);
761  void slotCopyMyChatPublicKey(void);
762  void slotCopyMyEmailPublicKey(void);
763  void slotCopyMyOpenLibraryPublicKey(void);
764  void slotCopyMyPoptasticPublicKey(void);
765  void slotCopyMyRosettaPublicKey(void);
766  void slotCopyMyURLPublicKey(void);
767  void slotCopyOrPaste(void);
768  void slotCopyPrivateApplicationMagnet(void);
769  void slotCopyStyleSheet(void);
770  void slotCopyTransmittedMagnet(void);
771  void slotCopyUrlFriendshipBundle(void);
772  void slotCopyUrlKeys(void);
773  void slotCorrectUrlDatabases(void);
774  void slotCostChanged(int value);
775  void slotDaysChanged(int value);
776  void slotDeactivateKernel(void);
777  void slotDeleteAEToken(void);
778  void slotDeleteAcceptedIP(void);
779  void slotDeleteAccount(void);
780  void slotDeleteAllBlockedNeighbors(void);
781  void slotDeleteAllListeners(void);
782  void slotDeleteAllNeighbors(void);
783  void slotDeleteAllReceived(void);
784  void slotDeleteAllTransmitted(void);
785  void slotDeleteAllUrls(void);
786  void slotDeleteAllUuids(void);
787  void slotDeleteEtpAllMagnets(void);
788  void slotDeleteEtpMagnet(void);
789  void slotDeleteInstitution(void);
790  void slotDeleteKey(void);
791  void slotDeleteListener(void);
792  void slotDeleteMail(void);
793  void slotDeleteNeighbor(void);
794  void slotDeleteNova(void);
795  void slotDeletePoptasticAccount(void);
796  void slotDeleteReceived(void);
797  void slotDeleteTransmitted(void);
798  void slotDeleteUrlDistillers(void);
799  void slotDeriveGeminiPairViaSMP(const QString &publicKeyHash,
800  const QString &oid);
801  void slotDeriveGeminiPairViaSMP(void);
802  void slotDetachListenerNeighbors(void);
803  void slotDisableSynchronousUrlImport(bool state);
804  void slotDisconnectAllNeighbors(void);
805  void slotDisconnectListenerNeighbors(void);
806  void slotDisconnectNeighbor(void);
807  void slotDiscover(void);
808  void slotDiscoverExternalAddress(void);
809  void slotDisplayPopups(bool state);
810  void slotDropUrlTables(void);
811  void slotDuplicateTransmittedMagnet(void);
812  void slotEmailFsGb(int index);
813  void slotEmailLettersPerPageChanged(int value);
814  void slotEmailPageChanged(int value);
815  void slotEmailSecretsActionSelected(void);
816  void slotEmptyTrash(void);
817  void slotEnableChatEmoticons(bool state);
818  void slotEnableRetrieveMail(void);
819  void slotEnabledPostOffice(bool state);
820  void slotEncryptionKeyTypeChanged(int index);
821  void slotEstablishForwardSecrecy(void);
822  void slotExportListeners(void);
823  void slotExportPublicKeys(void);
824  void slotExternalIp(int index);
825  void slotFavoritesActivated(int index);
826  void slotFindInSearch(void);
827  void slotFindInSearchInitialize(void);
828  void slotForceKernelRegistration(bool state);
829  void slotForwardSecrecyEncryptionKeyChanged(int index);
830  void slotGatherStatistics(void);
831  void slotGatherUrlStatistics(void);
832  void slotGeminiChanged(QTableWidgetItem *item);
833  void slotGeneralTimerTimeout(void);
834  void slotGenerateEtpKeys(int index);
835  void slotGenerateGeminiInChat(void);
836  void slotGenerateInstitutionKeyPair(void);
837  void slotGenerateNova(void);
838  void slotGenerateOneYearListenerCertificate(void);
839  void slotGoldBugDialogActionSelected(void);
840  void slotHideOfflineParticipants(bool state);
841  void slotImpersonate(bool state);
842  void slotImportNeighbors(void);
843  void slotImportPublicKeys(void);
844  void slotImportUrls(void);
845  void slotInitializeSMP(const QString &hash);
846  void slotInitializeSMP(void);
847  void slotInitiateSSLTLSSession(void);
848  void slotJoinBuzzChannel(void);
849  void slotKeepCopy(bool state);
850  void slotKeepOnlyUserDefinedNeighbors(bool state);
851  void slotKernelCipherTypeChanged(int index);
852  void slotKernelHashTypeChanged(int index);
853  void slotKernelKeySizeChanged(const QString &text);
854  void slotKernelLogEvents(bool state);
855  void slotKernelSocketError(QAbstractSocket::SocketError error);
856  void slotKernelSocketSslErrors(const QList<QSslError> &errors);
857  void slotKernelSocketState(void);
858  void slotKernelStatus(void);
859  void slotKernelUrlBatchSizeChanged(int value);
860  void slotKeysIndexChanged(const QString &text);
861  void slotLaneWidthChanged(int index);
862  void slotLaunchKernelAfterAuthentication(bool state);
863  void slotLimitConnections(int value);
864  void slotLimitSqliteSynchronization(bool state);
865  void slotLinkClicked(const QUrl &url);
866  void slotListenerChanged(QTableWidgetItem *item);
867  void slotListenerFullEcho(void);
868  void slotListenerHalfEcho(void);
869  void slotListenerIPComboChanged(int index);
870  void slotListenerMaximumChanged(int value);
871  void slotListenerSelected(void);
872  void slotListenerSourceOfRandomnessChanged(int value);
873  void slotLock(void);
874  void slotMagnetRadioToggled(bool state);
875  void slotMailContextMenu(const QPoint &point);
876  void slotMailRetrievalIntervalChanged(int value);
877  void slotMailSelected(QTableWidgetItem *item);
878  void slotMailSelected(void);
879  void slotMailTabChanged(int index);
880  void slotMaxMosaicSize(int value);
881  void slotMaximumClientsChanged(int index);
882  void slotMaximumEmailFileSizeChanged(int value);
883  void slotMaximumUrlKeywordsChanged(int value);
884  void slotMediaError(QMediaPlayer::Error error);
885  void slotMediaStatusChanged(QMediaPlayer::MediaStatus status);
886  void slotMessagesAnchorClicked(const QUrl &link);
887  void slotModeChanged(QSslSocket::SslMode mode);
888  void slotMonitorEvents(bool state);
889  void slotNeighborChanged(QTableWidgetItem *item);
890  void slotNeighborFullEcho(void);
891  void slotNeighborHalfEcho(void);
892  void slotNeighborMaximumChanged(int value);
893  void slotNeighborSilenceTimeChanged(int value);
894  void slotNeighborWaitForBytesWrittenChanged(int value);
895  void slotNewEmailWindow(void);
896  void slotNewGlobalName(void);
897  void slotNewKeys(bool state);
898  void slotNotificationsEnabled(bool state);
899  void slotOntopChatDialogs(bool state);
900  void slotOpenChatUrlChecked(bool state);
901  void slotPQUrlDatabaseFaulty(void);
902  void slotPageClicked(const QString &link);
903  void slotParticipantDoubleClicked(QTableWidgetItem *item);
904  void slotPassphraseAuthenticateRadioToggled(bool state);
905  void slotPassphraseChanged(const QString &text);
906  void slotPassphraseRadioToggled(bool state);
907  void slotPlaySounds(bool state);
908  void slotPopPoptastic(void);
909  void slotPoptasticAccountChanged(const QString &text);
910  void slotPoptasticSettingsReset(bool state);
911  void slotPoptasticSettingsReset(void);
912  void slotPopulateBuzzFavorites(void);
913  void slotPopulateEtpMagnets(void);
914  void slotPopulateListeners(void);
915  void slotPopulateNeighbors(QSqlDatabase *db,
916  QSqlQuery *query,
917  const QString &connectionName,
918  const int &size);
919  void slotPopulateNeighbors(void);
920  void slotPopulateParticipants(QSqlDatabase *db,
921  QSqlQuery *query,
922  const QString &connectionName);
923  void slotPopulateParticipants(void);
924  void slotPopulateStars(void);
925  void slotPostgreSQLConnect(void);
926  void slotPostgreSQLDisconnect(int index);
927  void slotPostgreSQLKernelUrlDistributionTimeout(int value);
928  void slotPostgreSQLWebServerCredentials(void);
929  void slotPrepareAndShowInstallationWizard(void);
930  void slotPrepareContextMenuMirrors(void);
931  void slotPrepareSMP(const QString &hash);
932  void slotPrepareSMP(void);
933  void slotPrepareUrlDatabases(void);
934  void slotPreviewStyleSheet(void);
935  void slotProtocolRadioToggled(bool state);
936  void slotProxyChecked(bool state);
937  void slotProxyTypeChanged(int index);
938  void slotPublicizeAllListenersPlaintext(void);
939  void slotPublicizeListenerPlaintext(void);
940  void slotPublishPeriodicallyToggled(bool state);
941  void slotPublishedKeySizeChanged(const QString &text);
942  void slotPurgeEphemeralKeyPair(void);
943  void slotPurgeEphemeralKeys(void);
944  void slotQuit(void);
945  void slotReceivedKernelMessage(void);
946  void slotReceiversChanged(QTableWidgetItem *item);
947  void slotReceiversClicked(bool state);
948  void slotRefreshMail(void);
949  void slotRefreshPostOffice(void);
950  void slotRefreshUrlDistillers(void);
951  void slotRegenerateKey(void);
952  void slotReloadEmailNames(void);
953  void slotRemoveAttachment(const QUrl &url);
954  void slotRemoveEmailParticipants(void);
955  void slotRemoveOtmOnExit(bool state);
956  void slotRemoveParticipants(void);
957  void slotRemoveUrlParticipants(void);
958  void slotRenameParticipant(void);
959  void slotReplayMessages(void);
960  void slotReply(void);
961  void slotResendMail(void);
962  void slotResetAETokenInformation(void);
963  void slotResetAccountInformation(void);
964  void slotResetAll(void);
965  void slotResetAllStyleSheets(void);
966  void slotResetCertificate(void);
967  void slotResetForwardSecrecyInformation(void);
968  void slotResetPrivateApplicationInformation(void);
969  void slotResetStyleSheet(void);
970  void slotRespondToForwardSecrecy(void);
971  void slotRetrieveMail(void);
972  void slotRewindFile(void);
973  void slotSOSSMaximumClientsChanged(int value);
974  void slotSaveAlternatingColors(bool state);
975  void slotSaveAttachment(void);
976  void slotSaveBuzzAutoJoin(bool state);
977  void slotSaveBuzzName(void);
978  void slotSaveCommonUrlCredentials(void);
979  void slotSaveCongestionAlgorithm(const QString &text);
980  void slotSaveCustomStatus(void);
981  void slotSaveDestination(void);
982  void slotSaveEmailName(void);
983  void slotSaveExternalIPUrl(void);
984  void slotSaveGeoIPPath(void);
985  void slotSaveKernelPath(void);
986  void slotSaveLineLimits(int value);
987  void slotSaveMOTD(void);
988  void slotSaveNodeName(void);
989  void slotSaveOpenLinks(bool state);
990  void slotSavePoptasticAccount(void);
991  void slotSaveRefreshEmail(bool state);
992  void slotSaveSecondaryStorage(bool state);
993  void slotSaveSharePrivateKeys(bool state);
994  void slotSaveSslControlString(void);
995  void slotSaveStarBeamAutoVerify(bool state);
996  void slotSaveUrlCredentials(void);
997  void slotSaveUrlDistribution(int index);
998  void slotSaveUrlName(void);
999  void slotScramble(bool state);
1000  void slotSearchResultsPerPage(int value);
1001  void slotSecureMemoryPoolChanged(int value);
1002  void slotSelectCAPath(void);
1003  void slotSelectDestination(void);
1004  void slotSelectGeoIPPath(void);
1005  void slotSelectKernelPath(void);
1006  void slotSelectTransmitFile(void);
1007  void slotSelectUrlIniPath(void);
1008  void slotSendMail(void);
1009  void slotSendMessage(void);
1010  void slotSeparateBuzzPage(void);
1011  void slotSetAETokenInformation(void);
1012  void slotSetCongestionMaxPageCount(int value);
1013  void slotSetIconSize(int index);
1014  void slotSetIcons(int index);
1015  void slotSetListenerSSLControlString(void);
1016  void slotSetNeighborPriority(void);
1017  void slotSetNeighborSSLControlString(void);
1018  void slotSetPassphrase(void);
1019  void slotSetPrivateApplicationInformation(void);
1020  void slotSetSBPulseSize(void);
1021  void slotSetSBReadInterval(void);
1022  void slotSetSocketOptions(void);
1023  void slotSetStyleSheet(void);
1024  void slotSetUrlIniPath(void);
1025  void slotSetWidgetStyleSheet(const QPoint &point);
1026  void slotShareBuzzMagnet(void);
1027  void slotShareChatPublicKey(void);
1028  void slotShareChatPublicKeyWithParticipant(void);
1029  void slotShareEmailPublicKey(void);
1030  void slotShareEmailPublicKeyWithParticipant(void);
1031  void slotShareKeysWithKernel(const QString &link);
1032  void slotShareOpenLibraryPublicKey(void);
1033  void slotSharePoptasticPublicKey(void);
1034  void slotShareStarBeam(void);
1035  void slotShareURLPublicKey(void);
1036  void slotShareUrlPublicKeyWithParticipant(void);
1037  void slotShowAddParticipant(void);
1038  void slotShowBuzzDetails(bool state);
1039  void slotShowBuzzTabContextMenu(const QPoint &point);
1040  void slotShowContextMenu(const QPoint &point);
1041  void slotShowDocumentation(void);
1042  void slotShowEncryptFile(void);
1043  void slotShowErrorMessage(void);
1044  void slotShowEtpMagnetsMenu(const QPoint &point);
1045  void slotShowMainTabContextMenu(const QPoint &point);
1046  void slotShowMinimalDisplay(bool state);
1047  void slotShowNeighborStatistics(void);
1048  void slotShowNotificationsWindow(void);
1049  void slotShowOptions(void);
1050  void slotShowPage(bool state);
1051  void slotShowReleaseNotes(void);
1052  void slotShowRss(void);
1053  void slotShowSMPWindow(void);
1054  void slotShowStatistics(void);
1055  void slotShowStatisticsWindow(void);
1056  void slotShowUrlSettings(bool state);
1057  void slotSignatureCheckBoxToggled(bool state);
1058  void slotSignatureKeyTypeChanged(int index);
1059  void slotStarBeamFragmented(bool state);
1060  void slotStarOTMCheckChange(bool state);
1061  void slotStatisticsGathered(void);
1062  void slotStatusButtonClicked(void);
1063  void slotStatusChanged(int index);
1064  void slotStyleSheetChanged(int index);
1065  void slotSuperEcho(int index);
1066  void slotTabChanged(int index);
1067  void slotTerminateKernelOnUIExit(bool state);
1068  void slotTestPoptasticPop3Settings(void);
1069  void slotTestPoptasticSmtpSettings(void);
1070  void slotTestSslControlString(void);
1071  void slotTimeSliderDefaults(void);
1072  void slotTimeSliderValueChanged(int value);
1073  void slotTransmit(void);
1074  void slotTransmittedPaused(bool state);
1075  void slotTransmittedSelected(void);
1076  void slotTransportChanged(int index);
1077  void slotUnblockNeighbor(void);
1078  void slotUnifyBuzz(void);
1079  void slotUpdateChatWindows(void);
1080  void slotUpdateSpinBoxChanged(double value);
1081  void slotUrlLinkClicked(const QUrl &u);
1082  void slotUrlPolarizerTypeChange(int index);
1083  void slotVacuumDatabases(void);
1084  void slotValidatePassphrase(void);
1085  void slotVerify(void);
1086  void slotVerifySMPSecret(const QString &hash,
1087  const QString &keyType,
1088  const QString &oid);
1089  void slotVerifySMPSecret(void);
1090  void slotViewEchoKeyShare(void);
1091  void slotViewLog(void);
1092  void slotViewRosetta(void);
1093  void slotWebServerAllowServingLocalContent(bool state);
1094  void slotWebServerInformationTimeout(void);
1095  void slotWebServerPortChanged(int value);
1096  void slotWebServerValueChangedTimeout(void);
1097  void slotWizardButtonClicked(void);
1098  void slotWizardCheckClicked(void);
1099 
1100  signals:
1101  void buzzNameChanged(const QByteArray &name);
1102  void dataReceived(const qint64 size);
1103  void dataSent(const qint64 size);
1104  void iconsChanged(void);
1105  void neighborsQueryReady(QSqlDatabase *db,
1106  QSqlQuery *query,
1107  const QString &connectionName,
1108  const int &size);
1109  void newEmailName(const QString &text);
1110  void newGlobalName(const QString &text);
1111  void participantAdded(const QString &type);
1112  void participantDeleted(const QString &oid, const QString &type);
1113  void participantNameChanged(const QByteArray &publicKeyHash,
1114  const QString &name);
1115  void participantsQueryReady(QSqlDatabase *db,
1116  QSqlQuery *query,
1117  const QString &connectionName);
1118  void pqUrlDatabaseFaulty(void);
1119  void smpMessageReceivedFromKernel(const QByteArrayList &list);
1120  void statusChanged(const QIcon &icon,
1121  const QString &name,
1122  const QString &id,
1123  const QString &toolTip);
1124  void updateEmailWindows(void);
1125 };
1126 
1127 class spoton_table_widget_item: public QTableWidgetItem
1128 {
1129  public:
1130  spoton_table_widget_item(const QString &text):QTableWidgetItem(text)
1131  {
1132  }
1133 
1134  spoton_table_widget_item(void):QTableWidgetItem()
1135  {
1136  }
1137 
1138  bool operator < (const QTableWidgetItem &other) const
1139  {
1140  static QRegExp s_regexp("[!+.:=@A-Za-z]");
1141 
1142  if(Qt::ItemIsUserCheckable & flags())
1143  return checkState() < other.checkState();
1144  else if(other.text().contains(s_regexp) || text().contains(s_regexp))
1145  return other.text() > text();
1146  else
1147  return other.text().remove(",").toLongLong() >
1148  text().remove(",").toLongLong();
1149  }
1150 };
1151 
1152 #if QT_VERSION >= 0x050600 && defined(SPOTON_WEBENGINE_ENABLED)
1153 class spoton_webengine_url_request_interceptor:
1154  public QWebEngineUrlRequestInterceptor
1155 {
1156  Q_OBJECT
1157 
1158  public:
1159  spoton_webengine_url_request_interceptor(QObject *parent):
1160  QWebEngineUrlRequestInterceptor(parent)
1161  {
1162  }
1163 
1164  ~spoton_webengine_url_request_interceptor()
1165  {
1166  }
1167 
1168  void interceptRequest(QWebEngineUrlRequestInfo &info)
1169  {
1170  info.block(true);
1171  }
1172 };
1173 #endif
1174 #endif
spoton_echo_key_share
Definition: spot-on-echo-key-share.h:40
spoton
Definition: spot-on.h:433
spoton_smpwindow
Definition: spot-on-smpwindow.h:61
spoton_status_activity
Definition: spot-on-status-activity.h:35
spoton_rss
Definition: spot-on-rss.h:43
spoton_table_item_delegate
Definition: spot-on.h:95
spoton_encryptfile
Definition: spot-on-encryptfile.h:35
spoton_virtual_keyboard
Definition: spot-on.h:118
spoton_forward_secrecy
Definition: spot-on.h:424
spoton_logviewer
Definition: spot-on-logviewer.h:38
spoton_crypt
Definition: spot-on-crypt.h:64
spoton_table_widget_item
Definition: spot-on.h:1127
spoton_smp
Definition: spot-on-smp.h:42
spoton_rosetta
Definition: spot-on-rosetta.h:46
spoton_documentation
Definition: spot-on-documentation.h:37
spoton_lineedit
Definition: spot-on.h:357
spoton_external_address
Definition: spot-on-external-address.h:35